summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-12-16 19:58:00 +0100
committerGitHub <noreply@github.com>2023-12-16 19:58:00 +0100
commit927be7561688c8b0e54026d70e3e47da4ae04ae3 (patch)
treebdbad9edb1dd94cd12befc2db2f6c27d63fcf564
parentMerge pull request #12335 from t895/per-game-settings (diff)
parentrenderer_vulkan: bound async presentation queue growth (diff)
downloadyuzu-927be7561688c8b0e54026d70e3e47da4ae04ae3.tar
yuzu-927be7561688c8b0e54026d70e3e47da4ae04ae3.tar.gz
yuzu-927be7561688c8b0e54026d70e3e47da4ae04ae3.tar.bz2
yuzu-927be7561688c8b0e54026d70e3e47da4ae04ae3.tar.lz
yuzu-927be7561688c8b0e54026d70e3e47da4ae04ae3.tar.xz
yuzu-927be7561688c8b0e54026d70e3e47da4ae04ae3.tar.zst
yuzu-927be7561688c8b0e54026d70e3e47da4ae04ae3.zip
-rw-r--r--src/video_core/renderer_vulkan/vk_present_manager.cpp13
-rw-r--r--src/video_core/renderer_vulkan/vk_present_manager.h2
2 files changed, 12 insertions, 3 deletions
diff --git a/src/video_core/renderer_vulkan/vk_present_manager.cpp b/src/video_core/renderer_vulkan/vk_present_manager.cpp
index 8e4c74b5c..a59e2d2d1 100644
--- a/src/video_core/renderer_vulkan/vk_present_manager.cpp
+++ b/src/video_core/renderer_vulkan/vk_present_manager.cpp
@@ -102,8 +102,8 @@ PresentManager::PresentManager(const vk::Instance& instance_,
memory_allocator{memory_allocator_}, scheduler{scheduler_}, swapchain{swapchain_},
surface{surface_}, blit_supported{CanBlitToSwapchain(device.GetPhysical(),
swapchain.GetImageViewFormat())},
- use_present_thread{Settings::values.async_presentation.GetValue()},
- image_count{swapchain.GetImageCount()} {
+ use_present_thread{Settings::values.async_presentation.GetValue()} {
+ SetImageCount();
auto& dld = device.GetLogical();
cmdpool = dld.CreateCommandPool({
@@ -289,7 +289,14 @@ void PresentManager::PresentThread(std::stop_token token) {
void PresentManager::RecreateSwapchain(Frame* frame) {
swapchain.Create(*surface, frame->width, frame->height);
- image_count = swapchain.GetImageCount();
+ SetImageCount();
+}
+
+void PresentManager::SetImageCount() {
+ // We cannot have more than 5 images in flight at any given time.
+ // FRAMES_IN_FLIGHT is 7, and the cache TICKS_TO_DESTROY is 6.
+ // Mali drivers will give us 6.
+ image_count = std::min<size_t>(swapchain.GetImageCount(), 5);
}
void PresentManager::CopyToSwapchain(Frame* frame) {
diff --git a/src/video_core/renderer_vulkan/vk_present_manager.h b/src/video_core/renderer_vulkan/vk_present_manager.h
index 337171a09..23ee61c8c 100644
--- a/src/video_core/renderer_vulkan/vk_present_manager.h
+++ b/src/video_core/renderer_vulkan/vk_present_manager.h
@@ -62,6 +62,8 @@ private:
void RecreateSwapchain(Frame* frame);
+ void SetImageCount();
+
private:
const vk::Instance& instance;
Core::Frontend::EmuWindow& render_window;